#!/bin/bash

while true
do
    ens33_in=$(ifconfig eth0 | grep -E "RX packets" | awk '{print $5}')
    ens33_out=$(ifconfig eth0 | grep -E "TX packets" | awk '{print $5}')
    inK=$((ens33_in / 1024))
    outK=$((ens33_out / 1024))

    echo "网卡接收的流量为：$ens33_in bit/s, $inK K/s"
    echo "网卡发送的流量为：$ens33_out bit/s, $outK K/s"

    #TODO:大小b切换

    #控制下刷新时间为2s
    sleep 2
done